package me.khrystal.rxnews.module.photo.presenter;

import me.khrystal.rxnews.base.BasePresenterImpl;
import me.khrystal.rxnews.bean.SinaPhotoDetail;
import me.khrystal.rxnews.module.photo.model.IPhotoDetailInteractor;
import me.khrystal.rxnews.module.photo.model.IPhotoDetailInteractorImpl;
import me.khrystal.rxnews.module.photo.view.IPhotoDetailView;

/**
 * usage:
 * author: kHRYSTAL
 * create time: 16/4/29
 * update time:
 * email: 723526676@qq.com
 */
public class IPhotoDetailPresenterImpl
        extends BasePresenterImpl<IPhotoDetailView,SinaPhotoDetail>
        implements IPhotoDetailPresenter{

    private IPhotoDetailInteractor<SinaPhotoDetail> mDetailInteractor;

    public IPhotoDetailPresenterImpl(IPhotoDetailView view,String id,SinaPhotoDetail data) {
        super(view);
        mDetailInteractor = new IPhotoDetailInteractorImpl();
        if (data !=null){
            mView.initViewPager(data);
        }else {
            mSubscription = mDetailInteractor.requestPhotoDetail(this,id);
        }
    }

    @Override
    public void requestSuccess(SinaPhotoDetail data) {
        mView.initViewPager(data);
    }
}
